package service.impl;

import bean.dto.CostPage;
import bean.vo.CostOption;
import bean.vo.PeopleCostVo;
import bean.vo.RoomListOption;
import dao.CostManagementDao;
import dao.PeopleCostMangerDao;
import dao.impl.CostManagementDaoImpl;
import dao.impl.PeopleCostMangerDaoImpl;
import service.PeopleCostMangerService;

import java.util.List;

/**
 * service.impl
 * User: xlh
 * Date: 2024/12/19 10:10
 * motto:推到高塔
 * Description:
 * Version: V1.0
 */
public class PeopleCostMangerServiceImpl implements PeopleCostMangerService {


    private PeopleCostMangerDao peopleCostMangerDao =new PeopleCostMangerDaoImpl();

    @Override
    public Long findByTotal(CostPage costPage) {
        //验证有没有值
        if(costPage.getTypeTime()==null  ||  costPage.getTypeTime().trim().length()==0){
            costPage.setTypeTime(null);
        }
        if(costPage.getTypeName()==null  ||  costPage.getTypeName().trim().length()==0){
            costPage.setTypeName(null);
        }
        if(costPage.getToken()==null  ||  costPage.getToken().trim().length()==0){
            costPage.setToken(null);
        }
        return   peopleCostMangerDao.findByTotal(costPage);
    }

    @Override
    public List<CostOption> findByPage(CostPage costPage) {
        return peopleCostMangerDao.findByPage(costPage);
    }

    @Override
    public boolean updateCostById(PeopleCostVo peopleCostVo) {
        return peopleCostMangerDao.updateCostById(peopleCostVo)>0;
    }
}
